handler n. 1.处理者,管理者。 2.(赛马、警犬等的)训练者。 3.【自动化】(信息)处理机。
document n. 1.文献,文件;公文。 2.证件,证书,凭证。 3.记录影片,记实小说。 4.【航海】船舶执照。 a diplomatic document 外交文件。 public documents 公文。 a document of searching 搜查证。 a document of shipping 装货单据。 a human document 人世间的记录。 vt. 1.用文件[证书等]证明,为…提供文件[证书等]。 2.根据事实材料制作(影片等)。 3.【航海】为(船舶)提供执照〔表明船的国籍、容量、所有权等〕。 a documented vessel 〔美国〕有执照的船。 a carefully documented biography 有详细文献根据的传记。 document a case 为案件提供文件资料。
Simplify document handler programs with the sax parser 使用sax解析器简化文档处理程序的编写
The first step in the design strategy is to write a generalized document handler 设计策略的第一步是编写一个通用的文档处理程序。
The sax parser, the document handler, and the external classes for the other elements do not need any changes sax解析器、文档处理程序以及用于其他元素的外部类都不需要作任何修改。
You can now change the behavior for one of the elements without changing either the document handler code or the code for the other elements 现在可以改变一个元素的行为,而不必修改文档处理程序代码或者其他元素的代码。
The document handler class is generalized through the use of the java reflection mechanism, while an abstract class is used to implement the element classes 通过使用java反射机制来泛化文档处理程序类,并使用一个抽象类来实现元素类。
The size and complexity of the document handler class increases with the number of different xml tags, up to the point where readability and maintenance can become very difficult 文档处理程序类的大小和复杂性随着不同xml标签数量的增加而增加,直到某个时候可读性和维护性都变得非常差。
Sometimes the code of a sax document handler can become cumbersome, poorly structured, and difficult to maintain, especially for complex xml structures with many different elements 有时候sax文档处理程序的代码可能变得非常麻烦、结构性差而且难以维护,尤其是对于那些包含多种不同元素的复杂xml结构。
In this article, i have shown you how document handler code, developed for handling the different elements in a parsed xml file, can be simplified by creating separate classes for each element 本文展示了在需要处理已解析xml文件中不同元素的文档处理程序代码中,如何通过为每种元素创建单独的类来简化编码。